﻿using System.Collections.Generic;
using com.youzu.warh.protocol;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
using UnityEngine.Rendering;

namespace Yoozoo.Gameplay.Liberty.AI.Node
{
    [Category("Ggame/Liberty")]
    public class NpcUpdateAimingDirection : AIBaseNode
    {
        public BBParameter<TargetType> targetType = TargetType.CurrentLockTarget;

        protected override void OnExecute()
        {
            AIEntity target = _entity.battleAgent.GetTarget(targetType.value);
            if (target != null)
            {
                Vector3 direction = (target.battleAgent.transform.position - _entity.battleAgent.transform.position);
                direction.y = 0;
                _entity.data.aimDirection = direction.normalized;
            }
            
            EndAction(true);
        }
        
    }
}